import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

/* Router Modules */
// import componentsRouter from './modules/components'
// import chartsRouter from './modules/charts'
// import tableRouter from './modules/table'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: "/redirect",
    component: Layout,
    hidden: true,
    children: [
      {
        path: "/redirect/:path(.*)",
        component: () => import("@/views/redirect/index")
      }
    ]
  },
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true
  },
  {
    path: "/register",
    component: () => import("@/components/Register"),
    hidden: true
  },
  {
    path: "/auth-redirect",
    component: () => import("@/views/login/auth-redirect"),
    hidden: true
  },
  {
    path: "/404",
    component: () => import("@/views/error-page/404"),
    hidden: true
  },
  {
    path: "/401",
    component: () => import("@/views/error-page/401"),
    hidden: true
  },
  {
    path: "/",
    component: Layout,
    // redirect: "/front-home"
    redirect: "/home"

    // children: [
    //   {
    //     path: "dashboard",
    //     component: () => import("@/views/dashboard/index"),
    //     name: "PC首页",
    //     meta: { title: "首页", icon: "dashboard", affix: true }
    //   }
    // ]
  },
  // {
  //   path: '/documentation',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/documentation/index'),
  //       name: 'Documentation',
  //       meta: { title: 'Documentation', icon: 'documentation' }
  //     }
  //   ]
  // },
  // {
  //   path: '/guide',
  //   component: Layout,
  //   redirect: '/guide/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/guide/index'),
  //       name: 'Guide',
  //       meta: { title: 'Guide', icon: 'guide', noCache: true }
  //     }
  //   ]
  // },
  {
    path: "/profile",
    component: Layout,
    redirect: "/profile/index",
    hidden: true,
    children: [
      {
        path: "index",
        component: () => import("@/views/profile/index"),
        name: "Profile",
        meta: { title: "用户信息", icon: "user", noCache: true}
      }
    ]
  },

  // 前台网站的路由
  {
    path: "/front-home",
    component: () => import("@/views/front/home/index"),
    name: "frontHome",
    meta: {
      title: "首页"
    },
    hidden: true
  },
  {
    path: "/home",
    component: () => import("@/views/front/home/newHome"),
    name: "NewHome",
    meta: {
      title: "首页"
    },
    hidden: true
  },
  {
    path: "/zouJin",
    component: () => import("@/views/front/home/zouJin"),
    name: "ZouJin",
    meta: {
      title: "走进众茶"
    },
    hidden: true
  },
  {
    path: "/newHomeZiXun",
    component: () => import("@/views/front/home/ziXun"),
    name: "ZiXun",
    meta: {
      title: "企业资讯"
    },
    hidden: true
  },
  {
    path: "/newHomeCooperation",
    component: () => import("@/views/front/home/newHomeCooperation"),
    name: "NewHomeCooperation",
    meta: {
      title: "商务合作"
    },
    hidden: true
  },
  {
    path: "/agentList",
    name: "AgentList",
    meta: {
      title: "经纪人专区"
    },
    component: () => import("@/views/front/agent/agentList.vue"),
    hidden: true
  },
  {
    path: "/agentGoodList",
    name: "AgentGoodList",
    meta: {
      title: "经纪人商品专区"
    },
    component: () => import("@/views/front/agent/agentGoodList.vue"),
    hidden: true
  },
  {
    path: "/front-transaction",
    name: "frontTransaction",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/index"),
    hidden: true
  },
  {
    path: "/front-transaction-list",
    name: "frontTransactionList",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/list"),
    hidden: true
  },
  {
    path: "/front-collection-list",
    name: "frontCollectionList",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/collection-list"),
    hidden: true
  },
  {
    path: "/front-collection-details",
    name: "frontCollectionDetails",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/collection-details"),
    hidden: true
  },
  {
    path: "/front-bidding-list",
    name: "frontBiddingList",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/bidding-list"),
    hidden: true
  },
  {
    path: "/front-bidding-details",
    name: "frontBiddinDetails",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/bidding-details"),
    hidden: true
  },
  {
    path: "/front-together-list",
    name: "frontTogetherList",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/together-list"),
    hidden: true
  },
  {
    path: "/front-together-details",
    name: "frontTogetherDetails",
    meta: {
      title: "四大交易"
    },
    component: () => import("@/views/front/transaction/together-details"),
    hidden: true
  },
  {
    path: "/front-news",
    component: () => import("@/views/front/news/index"),
    name: "frontNews",
    meta: {
      title: "资讯中心"
    },
    hidden: true
  },
  {
    path: "/front-newDetail",
    name: "newsDetail",
    meta: {
      title: "资讯详情"
    },
    component: () => import("@/views/front/news/detail"),
    hidden: true
  },
  {
    path: "/front-newsList",
    name: "newsList",
    meta: {
      title: "资讯列表"
    },
    component: () => import("@/views/front/news/list"),
    hidden: true
  },
  {
    path: "/front-about",
    name: "newsAbout",
    meta: {
      title: "关于众茶国际"
    },
    component: () => import("@/views/front/about/index"),
    hidden: true
  },
  {
    path: "/front-serve",
    name: "frontServe",
    meta: {
      title: "服务中心"
    },
    component: () => import("@/views/front/serve/index"),
    hidden: true
  },
  {
    path: "/front-serveDetail",
    name: "frontServeDetail",
    meta: {
      title: "服务详情"
    },
    component: () => import("@/views/front/serve/detail"),
    hidden: true
  },
  {
    path: "/front-dataCenter",
    name: "frontdataCenter",
    meta: {
      title: "金融中心"
    },
    component: () => import("@/views/front/dataCenter"),
    hidden: true
  },
  {
    path: "/front-dataDetail",
    name: "frontdataDetail",
    meta: {
      title: "金融详情"
    },
    component: () => import("@/views/front/dataCenter/detail.vue"),
    hidden: true
  },
  {
    path: "/front-storeCenter",
    name: "frontstoreCenter",
    meta: {
      title: "云仓中心"
    },
    component: () => import("@/views/front/storeCenter/newIndex.vue"),
    hidden: true
  },
	{
	  path: "/front-positions",
	  name: "frontPositions",
	  meta: {
	    title: "云仓中心"
	  },
	  component: () => import("@/views/front/storeCenter/positions"),
	  hidden: true
	},
  {
    path: "/front-help",
    name: "frontHelp",
    meta: {
      title: "帮助中心"
    },
    component: () => import("@/views/front/help"),
    hidden: true
  },
  {
    path: "/front-dataEcharts",
    name: "dataEcharts",
    meta: {
      title: "数据中心"
    },
    component: () => import("@/views/front/data-echarts/index.vue"),
    hidden: true
  },
  {
    path: "/front-memberCenter",
    name: "frontmemberCenter",
    meta: {
      title: "会员中心"
    },
    component: () => import("@/views/front/memberCenter"),
    hidden: true
  },
  {
    path: "/front-exhibition",
    name: "frontexhibition",
    meta: {
      title: "线上展会"
    },
    component: () => import("@/views/front/Exhibition/index.vue"),
    hidden: true
  },
	{
	  path: "/front-videoCenter",
	  name: "FrontVideoCenter",
	  meta: {
	    title: "直播中心",
      keepAlive: true
	  },
	  component: () => import("@/views/front/videoCenter"),
	  hidden: true
	},
	{
	  path: "/front-video",
	  name: "frontvideo",
	  meta: {
	    title: "视频"
	  },
	  component: () => import("@/views/front/videoCenter/video"),
	  hidden: true
	},
  {
	  path: "/liveVideo",
	  name: "liveVideo",
	  meta: {
	    title: "直播"
	  },
	  component: () => import("@/views/front/videoCenter/liveVideo"),
	  hidden: true
	},
  {
	  path: "/liveRecord",
	  name: "liveRecord",
	  meta: {
	    title: "直播录播"
	  },
	  component: () => import("@/views/front/videoCenter/liveRecord"),
	  hidden: true
	},
	{
	  path: "/front-cooperativebrand",
	  name: "CooperativeBrand",
	  meta: {
	    title: "合作品牌"
	  },
	  component: () => import("@/views/front/cooperative-brand"),
		 hidden: true
	},
	{
	  path: "/front-cooperation",
	  name: "frontcooperation",
	  meta: {
	    title: "商务合作"
	  },
	  component: () => import("@/views/front/cooperation"),
		 hidden: true
	},
  {
	  path: "/front-agreement",
	  name: "frontAgreement",
	  meta: {
	    title: "协议"
	  },
	  component: () => import("@/views/front/cooperation/agreement"),
		hidden: true
	},
  {
    path: "/front-goodList",
    name: "frontGoodList",
    meta: {
      title: "商品列表"
    },
    component: () => import("@/views/front/goods"),
    hidden: true
  },
  {
    path: "/front-shopList",
    name: "frontShopList",
    meta: {
      title: "店铺列表"
    },
    component: () => import("@/views/front/shop/list.vue"),
    hidden: true
  },
  {
    path: "/cart",
    name: "cart",
    meta: {
      title: "购物车"
    },
    component: () => import("@/views/front/cart"),
    hidden: true
  },
  {
    path: "/confirm-order",
    name: "confirm-order",
    meta: {
      title: "确认订单"
    },
    component: () => import("@/views/front/confirm-order"),
    hidden: true
  },
  {
    path: "/confirm-pay",
    name: "confirm-pay",
    meta: {
      title: "收银台"
    },
    component: () => import("@/views/front/confirm-order/pay.vue"),
    hidden: true
  },
  {
    path: "/confirm-payHtml",
    name: "confirm-payHtml",
    meta: {
      title: "收银台"
    },
    component: () => import("@/views/front/confirm-order/payHtml.vue"),
    hidden: true
  },
  {
    path: "/paySuccess",
    name: "paySuccess",
    meta: {
      title: "支付成功"
    },
    component: () => import("@/views/front/confirm-order/paySuccess.vue"),
    hidden: true
  },
  {
    path: "/activity",
    name: "activity",
    meta: {
      title: "报名活动"
    },
    component: () => import("@/views/activity/index.vue"),
    hidden: true
  },
  {
    path: "/front-shop",
    component: () => import("@/views/front/shop"),
    redirect: "/front-shop/home",
    name: "frontShop",
    hidden: true,
    children: [
      {
        path: "home",
        name: "frontShopHome",
        meta: {
          title: "店铺首页"
        },
        component: () => import("@/views/front/shop/home")
      },
      {
        path: "shopInfo",
        name: "frontShopInfo",
        meta: {
          title: "店铺介绍"
        },
        component: () => import("@/views/front/shop/shopInfo")
      },
      {
        path: "allProduct",
        name: "frontShopAllPro",
        meta: {
          title: "店铺-全部商品"
        },
        component: () => import("@/views/front/shop/allProduct")
      },
      {
        path: "productDetail",
        name: "frontShopProductDatail",
        meta: {
          title: "店铺-商品详情"
        },
        component: () => import("@/views/front/shop/productDetail")
      },
      {
        path: "shopImgs",
        name: "frontShopImgs",
        meta: {
          title: "店铺相册"
        },
        component: () => import("@/views/front/shop/imgs")
      },
      {
        path: "shopNews",
        name: "frontShopNews",
        meta: {
          title: "店铺动态"
        },
        component: () => import("@/views/front/shop/news")
      },
      {
        path: "shopNewsDetail",
        name: "frontShopNewsDetail",
        meta: {
          title: "店铺动态-详情"
        },
        component: () => import("@/views/front/shop/news/detail")
      },
      {
        path: "contact",
        name: "frontShopContact",
        meta: {
          title: "联系方式"
        },
        component: () => import("@/views/front/shop/contact")
      },
      {
        path: "enquiry",
        name: "frontShopEnquiry",
        meta: {
          title: "在线咨询"
        },
        component: () => import("@/views/front/shop/enquiry")
      }
    ]
  },
  {
    path: "/wxpay",
    name: "WXPay",
    meta: {
      title: "微信小程序支付"
    },
    component: () => import("@/views/WXPay/index.vue"),
    hidden: true
  },
  {
    path: "/frontHall",
    name: "frontHall",
    meta: {
      title: "网站供需大厅"
    },
    component: () => import("@/views/tradeHall/frontHall.vue"),
    hidden: true
  },
  {
    path: "/b2cAuth",
    name: "B2cAuth",
    meta: {
      title: "B2C认证"
    },
    component: () => import("@/views/icbc/index.vue"),
    hidden: true
  },
  {
    path: "/loan",
    name: "ZcLoan",
    meta: {
      title: "众茶贷"
    },
    component: () => import("@/views/icbc/loan.vue"),
    hidden: true
  },
  {
    path: "/loanSave",
    name: "ZcLoanSave",
    meta: {
      title: "众茶贷"
    },
    component: () => import("@/views/icbc/loanSave.vue"),
    hidden: true
  },
  {
    path: "/protocol",
    name: "Protocol",
    meta: {
      title: "众茶贷协议"
    },
    component: () => import("@/views/icbc/protocol.vue"),
    hidden: true
  },
  {
    path: "/zcyxBidding",
    name: "ZcyxBidding",
    meta: {
      title: "众茶优选绑定手机号"
    },
    component: () => import("@/views/zcyxWechat/bidding.vue"),
    hidden: true
  },
  {
    path: "/msnActivity",
    name: "MsnActivity",
    meta: {
      title: "短信活动"
    },
    component: () => import("@/views/zcyxWechat/msnActivity.vue"),
    hidden: true
  },
  {
    path: "/wxOrderDetail",
    name: "WXOrderDetail",
    meta: {
      title: "众茶优选订单详情"
    },
    component: () => import("@/views/zcyxWechat/wxOrderDetail.vue"),
    hidden: true
  },
  {
    path: "/privacyPolicy",
    name: "PrivacyPolicy",
    meta: {
      title: "隐私策略"
    },
    component: () => import("@/views/zcyxWechat/privacyPolicy.vue"),
    hidden: true
  },
  {
    path: "/serviceAgreement",
    name: "ServiceAgreement",
    meta: {
      title: "服务协议"
    },
    component: () => import("@/views/zcyxWechat/serviceAgreement.vue"),
    hidden: true
  },
  {
    path: "/cityManager",
    name: "CityManager",
    meta: {
      title: "城市合伙人"
    },
    component: () => import("@/views/zcyxWechat/cityManager.vue"),
    hidden: true
  },
];

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  {
    path: "/company",
    component: Layout,
    redirect: "/company/info/name=Identification",
    name: "company",
    meta: {
      title: "企业管理",
      icon: "el-icon-s-cooperation",
      code: "info_auth",
    },
    children: [
      // {
      //   path: "info/name=Company",
      //   component: () => import("@/views/profile/index"),
      //   name: "companyInfo",
      //   meta: {
      //     title: "企业基本信息",
      //     code: "info_base",
      //   }
      // },
      {
        path: "info/name=Identification",
        component: () => import("@/views/profile/index"),
        name: "companyIdentification",
        meta: {
          title: "企业认证信息",
          code: "info_auth",
          affix: true
        },
      },
			// {
			//   path: "info/name=ICBC",
			//   component: () => import("@/views/profile/index"),
			//   name: "companyICBC",
			//   meta: {
			//     title: "工行认证和充值",
			//     code: "info_ICBC"
			//   }
			// },
      {
        path: "address",
        component: () => import("@/views/company/address"),
        name: "companyAddress",
        meta: {
          title: "地址管理",
          code: "address"
        }
      },
      {
        path: "driver",
        component: () => import("@/views/company/driver"),
        name: "companyDriver",
        meta: {
          title: "物流及承运",
          code: "driver"
        }
      }
    ]
  },
  {
    path: "/icbc",
    component: Layout,
    redirect: "/icbc/index",
    name: "icbc",
    meta: {
      title: "工行认证和充值",
      icon: "el-icon-bank-card",
      code: "icbc"
    },
    children: [
      {
        path: "index",
        component: () => import("@/views/profile/components/ICBC.vue"),
        name: "icbcInfo",
        meta: {
          title: "工行认证和充值",
          code: "info_ICBC"
        }
      }
    ]
  },
  {
    path: "/mall",
    component: Layout,
    redirect: "/mall/enquiry",
    name: "mall",
    meta: {
      title: "商城管理",
      icon: "el-icon-chat-dot-square"
    },
    children: [
      {
        path: "enquiry",
        component: () => import("@/views/mall/enquiry"),
        name: "mallEnquiry",
        meta: {
          title: "询价单管理",
          code: "inquiry"
        }
      }
    ]
  },
  {
    path: "/shop",
    component: Layout,
    redirect: "/shop/productList",
    name: "shop",
    meta: {
      title: "店铺管理",
      icon: "el-icon-s-shop",
      code: "dpgl"
    },
    children: [
      {
        path: "productList",
        component: () => import("@/views/product/list"),
        name: "productList",
        meta: {
          title: "商品管理",
          code: "product"
        }
      },
      {
        path: "serviceProductList",
        component: () => import("@/views/product/serviceProduct"),
        name: "ServiceProductList",
        meta: {
          title: "服务商专区商品管理",
          code: "serviceProduct"
        }
      },
      {
        path: "serviceProductSave",
        component: () => import("@/views/product/serviceProduct/serviceProductSave"),
        name: "ServiceProductSave",
        meta: {
          title: "服务商专区商品编辑",
          code: "serviceProduct"
        },
        hidden: true
      },
      {
        path: "secProductList",
        component: () => import("@/views/product/secKill"),
        name: "secProductList",
        meta: {
          title: "秒杀商品管理",
          code: "seckill"
        }
      },
      {
        path: "killProductSave",
        component: () => import("@/views/product/secKill/killProductSave"),
        name: "killProductSave",
        meta: {
          title: "秒杀商品编辑",
          code: "seckill"
        },
        hidden: true
      },
      {
        path: "activityProductList",
        component: () => import("@/views/product/activity"),
        name: "activityProduct",
        meta: {
          title: "活动专区商品管理",
          code: "activityProduct"
        }
      },
      {
        path: "activityProductSave",
        component: () => import("@/views/product/activity/activityProductSave"),
        name: "activityProductSave",
        meta: {
          title: "活动专区商品编辑",
          code: "activityProduct"
        },
        hidden: true
      },
      {
        path: "bestProductList",
        component: () => import("@/views/product/bestProduct"),
        name: "activityProduct",
        meta: {
          title: "众茶优品商品管理",
          code: "shop:market"
        }
      },
      {
        path: "bestProductSave",
        component: () => import("@/views/product/bestProduct/bestProductSave"),
        name: "activityProductSave",
        meta: {
          title: "众茶优品商品编辑",
          code: "shop:market"
        },
        hidden: true
      },
      {
        path: "normalProductSave",
        component: () => import("@/views/product/list/normalProductSave"),
        name: "normalProductSave",
        meta: {
          title: "发布商品",
          // activeMenu: "/shop/productList",
          code: "product"
        },
        hidden: true
      },
      {
        path: "info",
        component: () => import("@/views/shop/info"),
        name: "shopInfo",
        meta: {
          title: "店铺基本信息",
          code: "shop:base"
        }
      },
      {
        path: "news/list",
        component: () => import("@/views/shop/list/news"),
        name: "shopNewsList",
        meta: {
          title: "店铺动态",
          code: "shop:dynamic"
        }
      },
      {
        path: "news/save",
        component: () => import("@/views/shop/list/newsSave"),
        name: "shopNewsListSave",
        meta: {
          title: "发布动态",
          noCache: true,
          activeMenu: "/shop/news/list",
          code: "shop:dynamic"
        },
        hidden: true
      },
      {
        path: "imgs/list",
        component: () => import("@/views/shop/list/imgs"),
        name: "shopImgsList",
        meta: {
          title: "店铺相册",
          code: "shop:image"
        }
      },
      {
        path: "imgs/save",
        component: () => import("@/views/shop/list/imgsSave"),
        name: "shopImgsListSave",
        meta: {
          title: "发布相册",
          noCache: true,
          activeMenu: "/shop/imgs/list",
          code: "shop:image"
        },
        hidden: true
      }
    ]
  },
  {
    path: "/customer",
    component: Layout,
    redirect: "/customer/agentProductList",
    name: "customer",
    meta: {
      title: "经销管理",
      icon: "el-icon-help",
      code: "jxgl"
    },
    children: [
      {
        path: "agentProductList",
        component: () => import("@/views/product/agent"),
        name: "agentProductList",
        meta: {
          title: "经销商品管理",
          code: "proxy"
        }
      },
      {
        path: "agentProductSave",
        component: () => import("@/views/product/agent/agentProductSave"),
        name: "agentProductSave",
        meta: {
          title: "经销商品编辑",
          code: "proxy"
        },
        hidden: true
      },
      {
        path: "agentList",
        component: () => import("@/views/product/agent/agentList.vue"),
        name: "agentList",
        meta: {
          title: "经销客户管理",
          code: "proxy_custom"
        }
      },
    ]
  },
  {
    path: "/microShop",
    component: Layout,
    redirect: "/microShop/microShopProductList",
    name: "microShop",
    meta: {
      title: "微商城管理",
      icon: "el-icon-help",
      code: "wscgl"
    },
    children: [
      {
        path: "microShopProductList",
        component: () => import("@/views/product/microShop/index"),
        name: "microShopProductList",
        meta: {
          title: "微商城商品管理",
          code: "micro_shop_product"
        }
      },
      {
        path: "microShopProductSave",
        component: () => import("@/views/product/microShop/microShopProductSave"),
        name: "microShopProductSave",
        meta: {
          title: "微商城商品编辑",
          code: "micro_shop_product"
        },
        hidden: true
      },
      {
        path: "microIndexRoll",
        component: () => import("@/views/product/microShop/indexRoll/index"),
        name: "MicroIndexRoll",
        meta: {
          title: "微商城轮播图",
          code: "micro_shop_lbt"
        },
      },
      {
        path: "microIndexRollSave",
        component: () => import("@/views/product/microShop/indexRoll/save"),
        name: "MicroIndexRollSave",
        meta: {
          title: "微商城轮播图编辑",
          code: "micro_shop_lbt"
        },
        hidden: true
      },
      {
        path: "microFastNews",
        component: () => import("@/views/product/microShop/fastNews/index"),
        name: "MicroFastNews",
        meta: { title: "快讯", code: "micro_shop_kx" }
      },
      {
        path: "microAbout",
        component: () => import("@/views/product/microShop/about/index"),
        name: "MicroAbout",
        meta: {
          title: "微商城关于我们",
          code: "micro_shop_about_us"
        },
      },
      {
        path: "microAboutSave",
        component: () => import("@/views/product/microShop/about/save"),
        name: "MicroAboutSave",
        meta: {
          title: "微商城关于我们编辑",
          code: "micro_shop_about_us"
        },
        hidden: true
      },
    ]
  },
  {
    path: "/zcyx",
    component: Layout,
    redirect: "/zcyx/zcyxProductList",
    name: "zcyx",
    meta: {
      title: "众茶优选管理",
      icon: "el-icon-help",
      code: "zcyxgl"
    },
    children: [
      {
        path: "zcyxProductList",
        component: () => import("@/views/product/zcyx"),
        name: "zcyxProductList",
        meta: {
          title: "众茶商品管理",
          code: "zcyx_product"
        }
      },
      {
        path: "zcyxProductSave",
        component: () => import("@/views/product/zcyx/zcyxProductSave"),
        name: "zcyxProductSave",
        meta: {
          title: "众茶商品编辑",
          code: "zcyx_product"
        },
        hidden: true
      },
      {
        path: "zcyxProductSeckillList",
        component: () => import("@/views/product/zcyx/zcyxProductSeckillList"),
        name: "zcyxProductSeckillList",
        meta: {
          title: "众茶秒杀商品管理",
          code: "zcyx_product_seckill"
        }
      },
      {
        path: "zcyxProductSeckillSave",
        component: () => import("@/views/product/zcyx/zcyxProductSeckillSave"),
        name: "zcyxProductSeckillSave",
        meta: {
          title: "众茶秒杀商品编辑",
          code: "zcyx_product_seckill"
        },
        hidden: true
      },
      {
        path: "zcyxProductSeckillPopularizeList",
        component: () => import("@/views/product/zcyx/zcyxProductSeckillPopularizeList"),
        name: "zcyxProductSeckillPopularizeList",
        meta: {
          title: "众茶推广秒杀商品管理",
          code: "zcyx_product_seckill_popularize"
        }
      },
      {
        path: "zcyxProductSeckillPopularizeSave",
        component: () => import("@/views/product/zcyx/zcyxProductSeckillPopularizeSave"),
        name: "zcyxProductSeckillPopularizeSave",
        meta: {
          title: "众茶推广秒杀商品编辑",
          code: "zcyx_product_seckill_popularize"
        },
        hidden: true
      },
      {
        path: "zcyxProductScoreList",
        component: () => import("@/views/product/zcyx/zcyxProductScoreList"),
        name: "ZcyxProductScoreList",
        meta: {
          title: "众茶积分商品管理",
          code: "zcyx_product_score"
        }
      },
      {
        path: "zcyxProductScoreSave",
        component: () => import("@/views/product/zcyx/zcyxProductScoreSave"),
        name: "ZcyxProductScoreSave",
        meta: {
          title: "众茶积分商品编辑",
          code: "zcyx_product_score"
        },
        hidden: true
      },
      {
        path: "zcyxAgentProductList",
        component: () => import("@/views/product/zcyx/zcyxAgentProductList"),
        name: "ZcyxAgentProductList",
        meta: {
          title: "经纪人专区商品管理",
          code: "zcyx_proxy"
        }
      },
      {
        path: "zcyxAgentProductSave",
        component: () => import("@/views/product/zcyx/zcyxAgentProductSave"),
        name: "ZcyxAgentProductSave",
        meta: {
          title: "经纪人专区商品编辑",
          code: "zcyx_proxy"
        },
        hidden: true
      },
      {
        path: "zcyxAgentBrandList",
        component: () => import("@/views/product/zcyx/zcyxAgentBrandList"),
        name: "ZcyxAgentBrandList",
        meta: {
          title: "经纪人专区品牌管理",
          code: "zcyx_proxy_brand"
        }
      },
      {
        path: "zcyxAgentList",
        component: () => import("@/views/product/zcyx/zcyxAgentList"),
        name: "ZcyxAgentList",
        meta: {
          title: "经纪人专区客户管理",
          code: "zcyx_proxy_custom"
        }
      },
      {
        path: "zcyxBarProductList",
        component: () => import("@/views/product/zcyx/zcyxBarProductList"),
        name: "ZcyxBarProductList",
        meta: {
          title: "众茶专柜商品管理",
          code: "zcyx_product_zg"
        }
      },
      {
        path: "zcyxBarProductSave",
        component: () => import("@/views/product/zcyx/zcyxBarProductSave"),
        name: "ZcyxBarProductSave",
        meta: {
          title: "众茶专柜商品编辑",
          code: "zcyx_product_zg"
        },
        hidden: true
      },
      {
        path: "zcyxProductDesign",
        component: () => import("@/views/product/zcyx/zcyxProductDesign"),
        name: "zcyxProductDesign",
        meta: {
          title: "今日推荐",
          code: "zcyx_product_design"
        },
      },
      {
        path: "zcyxAdvertisement",
        component: () => import("@/views/product/zcyx/zcyxAdvertisement"),
        name: "ZcyxAdvertisement",
        meta: {
          title: "众茶优选广告区",
          code: "zcyx_ad"
        },
      },
      {
        path: "zcyxArticleList",
        component: () => import("@/views/product/zcyx/article/index"),
        name: "ZcyxArticleList",
        meta: {
          title: "优选会列表",
          code: "zcyx_info"
        },
        redirect: "/zcyx/zcyxArticleList/aboutZcyx",
        children: [
          {
            path: "aboutZcyx",
            component: () => import("@/views/product/zcyx/article/aboutZcyx/index"),
            name: "AboutZcyx",
            meta: { title: "了解优选", code: "zcyx_info" }
          },
          {
            path: "aboutZcyxSave",
            component: () => import("@/views/product/zcyx/article/aboutZcyx/save"),
            name: "AboutZcyxSave",
            meta: { title: "了解优选编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "teaKnowledge",
            component: () => import("@/views/product/zcyx/article/teaKnowledge/index"),
            name: "TeaKnowledge",
            meta: { title: "茶知识", code: "zcyx_info" }
          },
          {
            path: "teaKnowledgeSave",
            component: () => import("@/views/product/zcyx/article/teaKnowledge/save"),
            name: "TeaKnowledgeSave",
            meta: { title: "茶知识编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "famousMaster",
            component: () => import("@/views/product/zcyx/article/famousMaster/index"),
            name: "FamousMaster",
            meta: { title: "名师分享", code: "zcyx_info" }
          },
          {
            path: "famousMasterSave",
            component: () => import("@/views/product/zcyx/article/famousMaster/save"),
            name: "FamousMasterSave",
            meta: { title: "名师分享编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "famousMountain",
            component: () => import("@/views/product/zcyx/article/famousMountain/index"),
            name: "FamousMountain",
            meta: { title: "名山名寨", code: "zcyx_info" }
          },
          {
            path: "famousMountainSave",
            component: () => import("@/views/product/zcyx/article/famousMountain/save"),
            name: "FamousMountainSave",
            meta: { title: "名山名寨编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "zcyxVideo",
            component: () => import("@/views/product/zcyx/article/zcyxVideo/index"),
            name: "ZcyxVideo",
            meta: { title: "视频专区", code: "zcyx_info" }
          },
          {
            path: "zcyxVideoSave",
            component: () => import("@/views/product/zcyx/article/zcyxVideo/save"),
            name: "ZcyxVideoSave",
            meta: { title: "视频专区编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "articleManagement",
            component: () => import("@/views/product/zcyx/article/management/index"),
            name: "ArticleManagement",
            meta: { title: "经营之道", code: "zcyx_info" }
          },
          {
            path: "articleManagementSave",
            component: () => import("@/views/product/zcyx/article/management/save"),
            name: "ArticleManagementSave",
            meta: { title: "经营之道编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "judgeExchange",
            component: () => import("@/views/product/zcyx/article/judgeExchange/index"),
            name: "JudgeExchange",
            meta: { title: "品鉴交流", code: "zcyx_info" }
          },
          {
            path: "judgeExchangeSave",
            component: () => import("@/views/product/zcyx/article/judgeExchange/save"),
            name: "JudgeExchangeSave",
            meta: { title: "品鉴交流编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "industryInfo",
            component: () => import("@/views/product/zcyx/article/industryInfo/index"),
            name: "IndustryInfo",
            meta: { title: "行业资讯", code: "zcyx_info" }
          },
          {
            path: "industryInfoSave",
            component: () => import("@/views/product/zcyx/article/industryInfo/save"),
            name: "IndustryInfoSave",
            meta: { title: "行业资讯编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "famousProduct",
            component: () => import("@/views/product/zcyx/article/famousProduct/index"),
            name: "FamousProduct",
            meta: { title: "名品论坛", code: "zcyx_info" }
          },
          {
            path: "famousProductSave",
            component: () => import("@/views/product/zcyx/article/famousProduct/save"),
            name: "FamousProductSave",
            meta: { title: "名品论坛编辑", code: "zcyx_info" },
            hidden: true
          },
          {
            path: "fastNews",
            component: () => import("@/views/product/zcyx/article/fastNews/index"),
            name: "FastNews",
            meta: { title: "优选快讯", code: "zcyx_info" }
          },
        ]
      },
      {
        path: "zcyxCoupon",
        component: () => import("@/views/product/zcyx/coupon/index"),
        name: "ZcyxCoupon",
        meta: {
          title: "优惠券",
          code: "zcyx_coupon"
        },
      },
      {
        path: "zcyxCouponSave",
        component: () => import("@/views/product/zcyx/coupon/save"),
        name: "ZcyxCouponSave",
        meta: {
          title: "优惠券编辑",
          code: "zcyx_coupon"
        },
        hidden: true
      },
      {
        path: "zcyxIndexRoll",
        component: () => import("@/views/product/zcyx/indexRoll/index"),
        name: "ZcyxIndexRoll",
        meta: {
          title: "众茶优选轮播图",
          code: "zcyx_index_roll"
        },
      },
      {
        path: "zcyxIndexRollSave",
        component: () => import("@/views/product/zcyx/indexRoll/save"),
        name: "ZcyxIndexRollSave",
        meta: {
          title: "众茶优选轮播图编辑",
          code: "zcyx_index_roll"
        },
        hidden: true
      },
      {
        path: "/sjfx",
        component: () => import("@/views/product/zcyx/dataAnalysis/index"),
        name: "AnalysisList",
        redirect: "/sjfx/OrderAnalysis",
        meta: {
          title: "数据分析",
          code: "sjfx"
        },
        children: [
          {
            path: "orderAnalysis",
            component: () => import("@/views/product/zcyx/dataAnalysis/orderAnalysis.vue"),
            name: "OrderAnalysis",
            meta: {
              title: "订单统计",
              code: "sjfx"
            }
          },
          {
            path: "userAnalysis",
            component: () => import("@/views/product/zcyx/dataAnalysis/userAnalysis.vue"),
            name: "UserAnalysis",
            meta: {
              title: "用户统计",
              code: "sjfx"
            }
          },
          {
            path: "businessManAnalysis",
            component: () => import("@/views/product/zcyx/dataAnalysis/businessManAnalysis.vue"),
            name: "BusinessManAnalysis",
            meta: {
              title: "业务员统计",
              code: "sjfx"
            }
          },
          {
            path: "productAnalysis",
            component: () => import("@/views/product/zcyx/dataAnalysis/productAnalysis.vue"),
            name: "ProductAnalysis",
            meta: {
              title: "商品统计",
              code: "sjfx"
            }
          },
          {
            path: "articleAnalysis",
            component: () => import("@/views/product/zcyx/dataAnalysis/articleAnalysis.vue"),
            name: "ArticleAnalysis",
            meta: {
              title: "文章统计",
              code: "sjfx"
            }
          }
        ]
      },
    ]
  },
  {
    path: "/collect",
    component: Layout,
    redirect: "/collect/shop",
    name: "collect",
    meta: {
      title: "收藏夹",
      icon: "el-icon-collection",
      code: "scj"
    },
    children: [
      {
        path: "shop",
        component: () => import("@/views/collect/shop"),
        name: "collectShop",
        meta: {
          title: "店铺收藏",
          code: "collect:shop"
        }
      },
      {
        path: "product",
        component: () => import("@/views/collect/product"),
        name: "collectProduct",
        meta: {
          title: "商品收藏",
          code: "collect:product"
        }
      },
			{
			  path: "record",
			  component: () => import("@/views/collect/record/index"),
			  name: "collectRecord",
			  meta: {
			    title: "浏览记录",
			    code: "collect:record"
			  }
			},

    ]
  },
  {
    path: "/Live",
    component: Layout,
    redirect: "/Live/index",
    name: "Live",
    meta: {
      title: "直播管理",
      icon: "el-icon-video-camera-solid",
      code: "zbgl"
    },
    children: [
      {
        path: "index",
        component: () => import("@/views/Live/index"),
        name: "Live",
        meta: {
          title: "直播商品",
          code: "zb_product"
        }
      },{
        path: "childrenLive",
        component: () => import("@/views/Live/childrenLive"),
        name: "childrenLive",
        meta: {
          title: "子账号直播",
          code: "zb_children_product"
        }
      },{
        path: "appRecord",
        component: () => import("@/views/Live/appRecord"),
        name: "appRecord",
        meta: {
          title: "录播管理",
          code: "zb_record_product"
        }
      }

    ]
  },
  {
    path: "/purchaseOrder",
    component: Layout,
    redirect: "/purchaseOrder/mall",
    name: "purchaseOrder",
    meta: {
      title: "订单管理",
      icon: "el-icon-s-goods",
      code: "ddgl"
    },
    children: [
      {
        path: "zcyxOrder",
        component: () => import("@/views/mall/order/zcyxOrder/index.vue"),
        name: "zcyxOrder",
        meta: {
          title: "众茶优选订单",
          code: "zcyx_order"
        }
      },
      {
        path: "wechatOrder",
        component: () => import("@/views/mall/order/wechat/wechatOrder.vue"),
        name: "wechatOrder",
        meta: {
          title: "小程序订单",
          code: "caigou:xcx"
        }
      },
      {
        path: "scanOrder",
        component: () => import("@/views/mall/order/scan/index.vue"),
        name: "ScanOrder",
        meta: {
          title: "扫码支付订单",
          code: "order_scan"
        }
      },
      {
        path: "microShopOrder",
        component: () => import("@/views/mall/order/microShop/index.vue"),
        name: "microShopOrder",
        meta: {
          title: "微商城订单",
          code: "caigou:microShop"
        }
      },
      {
        path: "mall",
        component: () => import("@/views/mall/order/mallOrder"),
        name: "purchaseOrderMall",
        meta: {
          title: "商城交易订单",
          code: "caigou:mall"
        }
      },
      {
        path: "match",
        component: () => import("@/views/mall/order/match"),
        name: "purchaseOrderMatch",
        meta: {
          title: "买方挂牌订单",
          code: "caigou:match"
        }
      },
      {
        path: "group",
        component: () => import("@/views/mall/order/group"),
        name: "purchaseOrderGroup",
        meta: {
          title: "集采交易订单",
          code: "caigou:focus"
        }
      },
      {
        path: "bidding",
        component: () => import("@/views/mall/order/bidding"),
        name: "purchaseOrderBidding",
        meta: {
          title: "竞价交易订单",
          code: "caigou:bidding"
        }
      },
      {
        path: "entrust",
        component: () => import("@/views/mall/order/entrust"),
        name: "purchaseOrderentrust",
        meta: {
          title: "委托代购订单",
          code: "caigou:entrust"
        }
      },
      {
        path: "entrustSell",
        component: () => import("@/views/mall/order/entrust/sell.vue"),
        name: "purchaseOrderEntrustSell",
        meta: {
          title: "委托代售订单",
          code: "caigou:entrust_sell"
        }
      },
    ]
  },
  {
    path: "/transaction",
    component: Layout,
    name: "transaction",
    meta: { 
      title: "交易挂牌", 
      icon: "el-icon-coin",
      code: "jygp"
    },
    redirect: "/transaction/entrust",
    children: [
      {
        path: "entrust",
        component: () => import("@/views/transaction/entrust"),
        name: "transactionEntrust",
        meta: {
          title: "委托采购",
          code: "entrust_buy"
        }
      },
      {
        path: "entrust",
        component: () => import("@/views/transaction/entrust"),
        name: "transactionEntrust",
        meta: {
          title: "委托销售",
          code: "entrust_sell"
        }
      },
      {
        path: "groupBuying",
        component: () => import("@/views/transaction/groupBuying"),
        name: "transactionGroupBuying",
        meta: {
          title: "集采预售",
          code: "focus1"
        }
      },
      {
        path: "groupReg",
        component: () => import("@/views/transaction/groupReg"),
        name: "transactionGroupReg",
        meta: {
          title: "响应集采",
          code: "focus2"
        }
      },
      {
        path: "biddingBuying",
        component: () => import("@/views/transaction/biddingBuying"),
        name: "transactionBiddingBuying",
        meta: {
          title: "竞价采购",
          code: "bidding_buy"
        }
      },
      {
        path: "biddingBuyingSave",
        component: () => import("@/views/transaction/biddingBuying/save"),
        name: "biddingBuyingSave",
        meta: {
          title: "发布竞价",
          noCache: true,
          activeMenu: "/transaction/biddingBuying",
        },
        hidden: true
      },
      {
        path: "biddingBuying",
        component: () => import("@/views/transaction/biddingBuying"),
        name: "transactionBiddingBuying",
        meta: {
          title: "竞价销售",
          code: "bidding_sell"
        }
      },
      {
        path: "biddingReg",
        component: () => import("@/views/transaction/biddingReg"),
        name: "transactionBiddingReg",
        meta: {
          title: "响应竞价",
          code: "bidding2"
        }
      },
      {
        path: "match",
        component: () => import("@/views/transaction/match"),
        name: "transactionMatch",
        meta: {
          title: "挂牌采购",
          code: "match1"
        }
      },
      {
        path: "matchSave",
        component: () => import("@/views/transaction/match/save"),
        name: "transactionMatchSave",
        meta: {
          title: "发布挂牌",
          noCache: true,
          activeMenu: "/transaction/match",
          code: "match1"
        },
        hidden: true
      },
      {
        path: "matchReg",
        component: () => import("@/views/transaction/matchReg"),
        name: "transactionMatchReg",
        meta: {
          title: "响应挂牌",
          code: "match2"
        }
      }
    ]
  },
  {
    path: "/order",
    component: Layout,
    name: "mallOrder",
    meta: { title: "物流管理", icon: "nested" },
    redirect: "/order/pickUpGoods",
    children: [
      // {
      //   path: "pickUpGoods",
      //   component: () => import("@/views/mall/order/pickUpGoods"),
      //   name: "pickUpGoodsOrder",
      //   meta: {
      //     title: "提货单管理",
      //     code: "tihuodan"
      //   }
      // },
      {
        path: "dispatchBill",
        component: () => import("@/views/mall/order/dispatchBill"),
        name: "dispatchBillOrder",
        meta: {
          title: "发货单管理",
          code: "fahuodan"
        }
      },
      {
        path: "returned",
        component: () => import("@/views/mall/order/returned"),
        name: "returnedOrder",
        meta: {
          title: "退货单管理",
          code: "tuihuodan"
        }
      }
    ]
  },
  //结算管理
  {
    path: "/statement",
    component: Layout,
    name: "orderStatement",
    meta: { title: "结算管理", icon: "shopping" },
    redirect: "/statement/reconciliation",
    children: [
      {
        path: "reconciliation",
        component: () => import("@/views/mall/order/reconciliation"),
        name: "reconciliationOrder",
        meta: {
          title: "对账单管理",
          code: "duizhangdan"
        }
      },
      {
        path: "statement",
        component: () => import("@/views/mall/order/statement"),
        name: "finalStatement",
        meta: {
          title: "结算单管理",
          code: "jiesuandan"
        }
      }
    ]
  },
  {
    path: "/tradeHall",
    component: Layout,
    redirect: "/tradeHall/index",
    name: "tradeManagement",
    meta: {
      title: "供需大厅",
      icon: "el-icon-data-line",
      code: "gxdt"
    },
    children: [
      {
        path: "index",
        component: () => import("@/views/tradeHall"),
        name: "tradeHall",
        meta: {
          title: "供需大厅",
          code: "trade_hall",
        }
      },
      {
        path: "edit",
        component: () => import("@/views/tradeHall/edit"),
        name: "TradeHallEdit",
        meta: {
          title: "供需大厅编辑",
          code: "trade_hall",
        },
        hidden: true
      },
    ]
  },
  {
    path: "/flow",
    component: Layout,
    redirect: "/flow/index",
    name: "flowManagement",
    meta: {
      title: "流水管理",
      icon: "el-icon-s-management",
      code: "lsgl",
    },
    children: [
      {
        path: "index",
        component: () => import("@/views/flow"),
        name: "flow",
        meta: {
          title: "流水管理",
          code: "transaction_details",
        }
      },
    ],
    hidden: true
  },
  {
    path: "/xcxBill",
    component: Layout,
    redirect: "/xcxBill/xcxSettlement",
    name: "xcxBillManagement",
    meta: {
      title: "小程序对账单",
      icon: "el-icon-s-claim",
      code: "xcxdzd"
    },
    children: [
      // {
      //   path: "index",
      //   component: () => import("@/views/xcxBill"),
      //   name: "xcxBill",
      //   meta: {
      //     title: "小程序对账单",
      //     code: "xcx_statement",
      //   }
      // },
      {
        path: "xcxSettlement",
        component: () => import("@/views/xcxBill/xcxSettlement"),
        name: "xcxSettlement",
        meta: {
          title: "小程序结算帐单",
          code: "xcx_billing",
        }
      }
    ]
  },
  // {
  //   path: "/report",
  //   component: Layout,
  //   redirect: "/report/purchase",
  //   name: "report",
  //   meta: {
  //     title: "报表中心",
  //     icon: "el-icon-c-scale-to-original"
  //   },
  //   children: [
  //     {
  //       path: "purchase",
  //       component: () => import("@/views/report/purchase"),
  //       name: "reportPurchase",
  //       meta: {
  //         title: "采购明细",
  //         code: "report1"
  //       }
  //     },
      // {
      //   path: "market",
      //   component: () => import("@/views/report/market"),
      //   name: "reportMarket",
      //   meta: {
      //     title: "销售明细",
      //     code: "report2"
      //   }
      // }
  //   ]
  // },
  {
    path: "/store",
    component: Layout,
    redirect: "/store/list",
    name: "store",
    meta: {
      title: "云仓管理",
      icon: "el-icon-house",
      code: "ycgl"
    },
    children: [
      // {
      //   path: "list",
      //   component: () => import("@/views/store"),
      //   name: "storeList",
      //   meta: {
      //     title: "云仓管理",
      //     code: "store:record"
      //   }
      // }
      {
        path: "list",
        component: () => import("@/views/store/list.vue"),
        name: "storeList",
        meta: {
          title: "云仓管理",
          code: "store:record"
        }
      }
    ]
  },
  {
    path: "/recommend",
    component: Layout,
    redirect: "/recommend/user",
    name: "recommend",
    meta: {
      title: "推荐用户",
      icon: "el-icon-user",
      code: "tjyh"
    },
    children: [
      {
        path: "user",
        component: () => import("@/views/recommend"),
        name: "recommendUser",
        meta: {
          title: "推荐用户",
          code: "recommend"
        }
      }
    ]
  },
  //系统管理
  {
    path: "/system",
    component: Layout,
    redirect: "/system/account",
    name: "system",
    meta: {
      title: "系统管理",
      icon: "el-icon-s-tools",
      code:"xtgl"
    },
    children: [
      {
        path: "account",
        component: () => import("@/views/system/account"),
        name: "Account",
        meta: {
          title: "子账户管理",
          code: "son:account"
        }
      },
      {
        path: "role",
        component: () => import("@/views/system/role"),
        name: "Role",
        meta: {
          title: "角色管理",
          code: "role"
        }
      },
      {
        path: "role/save",
        component: () => import("@/views/system/role/save"),
        name: "roleSave",
        meta: {
          title: "保存角色",
          noCache: true,
          activeMenu: "/system/role",
          code: "role"
        },
        hidden: true
      },
      {
        path: "message",
        component: () => import("@/views/system/message"),
        name: "Message",
        meta: {
          title: "站内信管理",
          code: "message"
        }
      }
      // {
      //   path: 'department',
      //   component: () => import('@/views/system/department'),
      //   name: 'Department',
      //   meta: {
      //     title: '部门管理'
      //   }
      // }
    ]
  }
  // {
  //   path: '/permission',
  //   component: Layout,
  //   redirect: '/permission/page',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'Permission',
  //   meta: {
  //     title: 'Permission',
  //     icon: 'lock',
  //     roles: ['admin', 'editor'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'page',
  //       component: () => import('@/views/permission/page'),
  //       name: 'PagePermission',
  //       meta: {
  //         title: 'Page Permission',
  //         roles: ['admin'] // or you can only set roles in sub nav
  //       }
  //     },
  //     {
  //       path: 'directive',
  //       component: () => import('@/views/permission/directive'),
  //       name: 'DirectivePermission',
  //       meta: {
  //         title: 'Directive Permission'
  //         // if do not set roles, means: this page does not require permission
  //       }
  //     },
  //     {
  //       path: 'role',
  //       component: () => import('@/views/permission/role'),
  //       name: 'RolePermission',
  //       meta: {
  //         title: 'Role Permission',
  //         roles: ['admin']
  //       }
  //     }
  //   ]
  // },
  // process.env.NODE_ENV === "development" && {
  //   path: "/icon",
  //   component: Layout,
  //   children: [
  //     {
  //       path: "index",
  //       component: () => import("@/views/icons/index"),
  //       name: "Icons",
  //       meta: { title: "Icons", icon: "icon", noCache: true }
  //     }
  //   ]
  // },

  /** when your routing map is too long, you can split it into small modules **/
  // process.env.NODE_ENV === 'development' && componentsRouter,
  // chartsRouter,
  // tableRouter,

  // {
  //   path: '/example',
  //   component: Layout,
  //   redirect: '/example/list',
  //   name: 'Example',
  //   meta: {
  //     title: 'Example',
  //     icon: 'el-icon-s-help'
  //   },
  //   children: [
  //     {
  //       path: 'create',
  //       component: () => import('@/views/example/create'),
  //       name: 'CreateArticle',
  //       meta: { title: 'Create Article', icon: 'edit' }
  //     },
  //     {
  //       path: 'edit/:id(\\d+)',
  //       component: () => import('@/views/example/edit'),
  //       name: 'EditArticle',
  //       meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
  //       hidden: true
  //     },
  //     {
  //       path: 'list',
  //       component: () => import('@/views/example/list'),
  //       name: 'ArticleList',
  //       meta: { title: 'Article List', icon: 'list' }
  //     }
  //   ]
  // },

  // {
  //   path: '/tab',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/tab/index'),
  //       name: 'Tab',
  //       meta: { title: 'Tab', icon: 'tab' }
  //     }
  //   ]
  // },

  // {
  //   path: '/error',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'ErrorPages',
  //   meta: {
  //     title: 'Error Pages',
  //     icon: '404'
  //   },
  //   children: [
  //     {
  //       path: '401',
  //       component: () => import('@/views/error-page/401'),
  //       name: 'Page401',
  //       meta: { title: '401', noCache: true }
  //     },
  //     {
  //       path: '404',
  //       component: () => import('@/views/error-page/404'),
  //       name: 'Page404',
  //       meta: { title: '404', noCache: true }
  //     }
  //   ]
  // },

  // {
  //   path: '/error-log',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'log',
  //       component: () => import('@/views/error-log/index'),
  //       name: 'ErrorLog',
  //       meta: { title: 'Error Log', icon: 'bug' }
  //     }
  //   ]
  // },

  // {
  //   path: '/excel',
  //   component: Layout,
  //   redirect: '/excel/export-excel',
  //   name: 'Excel',
  //   meta: {
  //     title: 'Excel',
  //     icon: 'excel'
  //   },
  //   children: [
  //     {
  //       path: 'export-excel',
  //       component: () => import('@/views/excel/export-excel'),
  //       name: 'ExportExcel',
  //       meta: { title: 'Export Excel' }
  //     },
  //     {
  //       path: 'export-selected-excel',
  //       component: () => import('@/views/excel/select-excel'),
  //       name: 'SelectExcel',
  //       meta: { title: 'Export Selected' }
  //     },
  //     {
  //       path: 'export-merge-header',
  //       component: () => import('@/views/excel/merge-header'),
  //       name: 'MergeHeader',
  //       meta: { title: 'Merge Header' }
  //     },
  //     {
  //       path: 'upload-excel',
  //       component: () => import('@/views/excel/upload-excel'),
  //       name: 'UploadExcel',
  //       meta: { title: 'Upload Excel' }
  //     }
  //   ]
  // },

  // {
  //   path: '/zip',
  //   component: Layout,
  //   redirect: '/zip/download',
  //   alwaysShow: true,
  //   name: 'Zip',
  //   meta: { title: 'Zip', icon: 'zip' },
  //   children: [
  //     {
  //       path: 'download',
  //       component: () => import('@/views/zip/index'),
  //       name: 'ExportZip',
  //       meta: { title: 'Export Zip' }
  //     }
  //   ]
  // },

  // {
  //   path: '/pdf',
  //   component: Layout,
  //   redirect: '/pdf/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/pdf/index'),
  //       name: 'PDF',
  //       meta: { title: 'PDF', icon: 'pdf' }
  //     }
  //   ]
  // },
  // {
  //   path: '/pdf/download',
  //   component: () => import('@/views/pdf/download'),
  //   hidden: true
  // },

  // {
  //   path: '/theme',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/theme/index'),
  //       name: 'Theme',
  //       meta: { title: 'Theme', icon: 'theme' }
  //     }
  //   ]
  // },

  // {
  //   path: '/clipboard',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/clipboard/index'),
  //       name: 'ClipboardDemo',
  //       meta: { title: 'Clipboard', icon: 'clipboard' }
  //     }
  //   ]
  // },

  // 404 page must be placed at the end !!!
  // { path: "*", redirect: "/404", hidden: true }
];

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router
}

export default router;
